package com.designoutput.ui
{
	import com.designoutput.icon.Menubarbg;
	import com.designoutput.ui.controls.MenuTitle;
	
	import flash.display.Bitmap;
	import flash.display.Sprite;
	import flash.events.MouseEvent;
	
	
	public class TabMenuBar extends Sprite
	{
		
		private var bg:Bitmap;
		internal var active:Boolean=false;

		private var p:DesignoutputCard;

		private var layout:MenuTitle;
		private var gallery:MenuTitle;
		public function TabMenuBar(parent:DesignoutputCard)
		{
			this.p=parent;
			//this.cm=parent.cm;
			this.bg=new Bitmap(new Menubarbg(0, 0));
			addChild(this.bg);
			var offsetX:int=3;
			layout=new MenuTitle("rm_layout", "layout");
			layout.addEventListener(MouseEvent.MOUSE_DOWN, this.MenuTitleMouseDown, false, 0, true);
			layout.addEventListener(MouseEvent.ROLL_OVER, this.MenuTitleMouseOver, false, 0, true);
			layout.x=offsetX;
			layout.y=1;
			offsetX=offsetX + (layout.width + 3);
			addChild(layout);
			
			gallery=new MenuTitle("rm_gallery", "gallery ");
			gallery.addEventListener(MouseEvent.MOUSE_DOWN, this.MenuTitleMouseDown, false, 0, true);
			gallery.addEventListener(MouseEvent.ROLL_OVER, this.MenuTitleMouseOver, false, 0, true);
			gallery.x=offsetX;
			gallery.y=1;
			addChild(gallery);
			
		}
		
		private function SetMenu(param1:String):void
		{
			switch (param1)
			{
				default:
				{
					break;
				}
			}
		}
		
		private function MenuTitleMouseOver(evt:MouseEvent):void
		{
		}
		
//		private function MenuClick(evt:MenuEvent):void
//		{
//			dispatchEvent(new MenuEvent(evt.order));
//		}
		
		private function MenuTitleMouseDown(evt:MouseEvent):void
		{
			if(evt.currentTarget == this.layout){
				this.p.showLayout();
			}else{
				this.p.showGallery();
			}
			
		}
		
		public function Resize():void
		{
			this.bg.width=stage.stageWidth;
		}
		
		private function HideAll():void
		{
		}
		
		private function StageMouseDown(evt:MouseEvent):void
		{
		}
	}
}